package com.ybkj.o2o.mc.common.query;

import java.io.Serializable;
import java.util.Date;

import org.apache.commons.lang.StringUtils;

/**
 * 
 * @author Yuan Tianyang.---2017/7/1
 *
 */
public class DepartmentQuery implements Serializable{
	
	private String name;
	
	private Long companyId;
	
	private Long enterpriseId;
	
	private Date startTime;
	
	private Date endTime;
	
    private String appKey;
    
    private Long parentId;

    private Integer page; 
 
    private Integer rows;

    private Integer offset;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		if (StringUtils.isNotBlank(name)) {
	      this.name = "%" + name + "%";
	    } else {
	      this.name = null;
	    }
	}

	public Long getCompanyId() {
		return companyId;
	}

	public void setCompanyId(Long companyId) {
		this.companyId = companyId;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Long start) {
		if (null != start) {
	      this.startTime = new Date(start);
	    }
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Long end) {
		if (null != end) {
	      this.endTime = new Date(end);
	    }
	}

	public String getAppKey() {
		return appKey;
	}

	public void setAppKey(String appKey) {
		this.appKey = appKey;
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getRows() {
		return rows;
	}

	public void setRows(Integer rows) {
		this.rows = rows;
	}

	public Integer getOffset() {
		if (null != getPage() && getPage() > 0) {
	      return (getPage() - 1) * getRows();
	    }
	    return offset;
	}

	public void setOffset(Integer offset) {
		this.offset = offset;
	}

	@Override
	public String toString() {
		return "DepartmentQuery [name=" + name + ", companyId=" + companyId
				+ ", startTime=" + startTime + ", endTime=" + endTime
				+ ", appKey=" + appKey + ", page=" + page + ", rows=" + rows
				+ ", offset=" + offset + "]";
	}

	public Long getEnterpriseId() {
		return enterpriseId;
	}

	public void setEnterpriseId(Long enterpriseId) {
		this.enterpriseId = enterpriseId;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}	
	
    
	
	
}
